<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>

<c:choose>
	<c:when test="${q2 != nul}">
		<p>${fn:escapeXml("#{ db.(Employee where boss.lastName in(names)) };")}</p>
		<table class="table table-hover">
			<thead>
				<tr>
					<th>Pracownik</th>
					<th>Przełożony</th>
					<th>Stanowisko</th>
				</tr>
			</thead>
			<tbody>
				<c:forEach var="emp" items="${q2}">
					<tr>
						<td>
							<c:out value="${emp.firstName}"/> <c:out value="${emp.lastName}"/>
						</td>
						<td>
							<c:choose>
								<c:when test="${emp.boss != null}">
									<c:out value="${emp.boss.firstName}"/> <c:out value="${emp.boss.lastName}"/>
								</c:when>
								<c:otherwise>
									-
								</c:otherwise>
							</c:choose>
						</td>
						<td>
							<c:out value="${emp.job}" />
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</c:when>
	<c:otherwise>
		<p>Sorry no data found ;(</p>
	</c:otherwise>
</c:choose>